<template>
    <div>
        <van-icon name="arrow-left" style="margin-top: 11px; float: left;" @click="syy" />
        <NavBar :title="title" style=" margin-left: 15px;"></NavBar>
    </div>

    <van-row>
        <van-col span="6">
            <van-sidebar v-model="active">
                <van-sidebar-item v-for="item in categoriesApiData" :title="item.cat_name" />
            </van-sidebar>
        </van-col>

        <van-col span="5">.
                <div v-if="categoriesApiData.length<=0">
          <van-skeleton title :row="18" />
    </div>
            <div v-else v-for="item in categoriesApiData[active]?.children">
                <h3>{{ item.cat_name }}</h3>
                <div v-for="item in item.children">
                    <router-link :to="'/lb/' + item.query">
                        <van-grid>
                            <van-grid-item :icon="item.cat_icon" :text="item.cat_name" />
                        </van-grid>
                    </router-link>

                </div>

            </div>
        </van-col>

    </van-row>



</template>

<script setup>
import { ref } from 'vue'
import { NavBar } from 'vant';
let title = '分类 '
import { useRouter } from 'vue-router';
const router = useRouter()
const syy = () => {
    router.push('/home/cla')
}

import { categoriesApi } from '@/api/api'
const categoriesApiData = ref([])
categoriesApi().then(res => {
    console.log('分类', res);
    categoriesApiData.value = res.data.message
})

const active = ref(0);
</script>

<style lang="scss" scoped></style>